<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
	global $db;
?>
<script type="text/javascript" >
	jQuery(document).ready(function(){
		//jQuery('a[rel^="prettyPhoto"]').prettyPhoto({theme:'facebook'});
		 jQuery("#lage-image").prettyPhoto();
		 
	});
</script> 

<script type="text/javascript">
$(document).ready(function(){
	var options = {
	    zoomWidth: 300,
	    zoomHeight: 245,
        xOffset: 10, //khoan cach cua view voi image X
        yOffset: 0, //khoan cach cua view voi image Y
        position: "right" //and MORE OPTIONS :bottom:right
    };
	$('.jqzoom').jqzoom(options);
	$('#btn_submit1').click(function(){
		var id = <?php echo $product[0]->product_id; ?>;
		var quantity = $('#btn_submit').attr('value');
		if(validate_detail()==true){
		$.ajax
			({
				type:"POST",
				url:"<?php echo JURI::base(); ?>index2.php",
				data:"option=com_virtuemart&product_id="+id+"&prod_id[]="+id+"&page=shop.cart&carttype=buying&func=cartAdd&Itemid=&quantity="+quantity+"&description=&<?php echo $attribute[0][0].$product[0]->product_id; ?>="+$("#ha-size").val(),
				success:function(result)
				{
					window.location="index.php?option=com_virtuemart&page=shop.cart";
				}
			});
		}
	});
	validate_detail = function(){
		var flag = true;
		if(jQuery('#ha-size').attr("value")=="<?php echo $VM_LANG->_('HA_CHOOSE_SIZE_LB'); ?>"){
			$("#alert").html("<?php echo $VM_LANG->_('HA_PLZ_CHOOSE_SIZE'); ?>");
			$('#backoverlay').show();
			$('#show_popup').show();
			flag = false;
		}else{
			var temp = parseInt(jQuery("#btn_submit").attr("value"));
			if(isNaN(temp)==true){
				$("#alert").html("<?php echo $VM_LANG->_('HA_PLZ_ENTER_NUMBER_ONLY'); ?>");
				$('#backoverlay').show();
				$('#show_popup').show();
				flag = false;
			}else{
				if(temp < 1){
					$("#alert").html("<?php echo $VM_LANG->_('HA_PLZ_GREATER_THAN_ZERO'); ?>");
					$('#backoverlay').show();
					$('#show_popup').show();
					flag = false;
				}
			}
		}
		return flag;
	};
});
</script>
<div class="containerUnder">
	<div class="collectionLeft">
		<div class="mainTitle"><?php echo $VM_LANG->_('HA_SHOPPING_CART'); ?></div>
		<ul class="cartCategory">
			<?php 
				for($i=0;$i<count($category);$i++){
					if($category_id != $category[$i]->category_id ){
						echo "<li><a href=\"index.php?option=com_virtuemart&page=shop.list&category_id=".$category[$i]->category_id."&Itemid=".$Itemid."\" class=\"cartCategory\">".$category[$i]->category_name."</a></li>";
					}else{
						echo "<li><a id=\"catSelect\" href=\"index.php?option=com_virtuemart&page=shop.list&category_id=".$category[$i]->category_id."\" class=\"cartCategory\">".$category[$i]->category_name."</a></li>";
					}
				}
			?>
		</ul>
	   
	</div>
	<div class="productDetail">
		<div class="productDetailMain">
			<div id="picture-slides-frame">
			
				<div id="picture-slides-container">
					<a href="<?php echo JURI::base(); ?>components/com_virtuemart/shop_image/product/<?php echo $product[0]->product_full_image; ?>" class="jqzoom" style="" title="Zoom">
					<img alt="" width="435" src="<?php echo JURI::base(); ?>components/com_virtuemart/shop_image/product/<?php echo $product[0]->product_full_image; ?>" id="picture-slides-image" />
					</a>
				</div>
			</div>
			<div class="clr space10"></div>
			<a href="<?php echo JURI::base(); ?>components/com_virtuemart/shop_image/product/<?php echo $product[0]->product_full_image; ?>" id="lage-image" class="float-left"><img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/btn_zoom.png" alt=""/></a>
			<div class="img-caption"><?php echo $product[0]->product_s_desc; ?></div>
			<div id="picture-slides-thumbnails">
				<ul class="thumb">
					<li class="selected-parent">
						<a href="#" title="Bat bridge in Austin">
							<img src="<?php echo JURI::base(); ?>components/com_virtuemart/shop_image/product/<?php echo $product[0]->product_full_image; ?>" alt="Bat bridge in Austin"/>
						</a>
					</li>
					<?php 
						if(count($more_image) > 0){
					?>
					<li>
						<a href="#" title="Blossoming tree">
							<img src="<?php echo JURI::base().$more_image[0]->file_name; ?>" alt="Blossoming tree"/>
						</a>
					</li>
					<?php 
						}
						if(count($more_image) > 1){
					?>
					<li style="margin-right:0px;">
						<a href="#" title="Bat bridge from below">
							<img src="<?php echo JURI::base().$more_image[1]->file_name; ?>" alt="Bat bridge from below"/>
						</a>	
					</li>
					<?php 
						}
					?>
				</ul>
			</div>
			<div class="clr"></div>
			<div class="productDetail_panel">
				<div class="productDetail_panelName"><?php echo $product[0]->product_name; ?></div>
				<div class="productDetail_panelPrice"><?php echo $CURRENCY_DISPLAY->getFullValue($price[0]->product_price);  ?></div>
				<div class="clr"></div>
			</div>
			<div class="productDetailTxt">
				<?php echo $product[0]->product_desc; ?>
			</div>
			<select id="ha-size" class="productDetail">
				<option><?php echo $VM_LANG->_('HA_CHOOSE_SIZE_LB'); ?></option>
				<?php 
					for($i=1;$i<count($attribute[0]);$i++){
						echo "<option>".$attribute[0][$i]."</option>";
					}
				?>
			</select>
			<div class="productDetailLabel"><?php  echo $VM_LANG->_('HA_DETAIL_QTY_LB'); ?>:</div>
			<input type="text" id="btn_submit" class="productDetail" value="1"/>
			<div class="clr"></div>
			<a href="#" class="size-guide"><?php echo $VM_LANG->_('HA_SIZE_GUIDE_LB'); ?></a>
			<div class="productDetail_button">
				<div class="productDetail_button">
					<a id="btn_submit1" class="btn btn-til float-left" style="cursor:pointer;"><span><?php echo $VM_LANG->_('HA_ADD_TO_BASKET_BTN'); ?></span></a>
				</div>
				
			</div>
		</div>
		<div class="productDetailSecondary">
			<p class="p14"><?php echo $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS'); ?></p>
			<div class="space10"></div>
			<?php 
				for($i=0;$i<count($relations);$i++){
			?>
			<div class="productDetail_Item">
				<a href="index.php?option=com_virtuemart&page=shop.detail&category_id=<?php echo $category_id; ?>&id=<?php echo $relations[$i]->product_id;?>"><img width="210" src="<?php echo JURI::base(); ?>components/com_virtuemart/shop_image/product/<?php echo $relations[$i]->product_full_image; ?>" alt=""/><span><?php echo $relations[$i]->product_s_desc; ?></span></a>
				<div class="productDetail_ItemName"><?php echo $relations[$i]->product_name; ?></div>
				<div class="productDetail_ItemPrice"><?php echo $CURRENCY_DISPLAY->getFullValue($price_related[$i]); ?>
				</div>
				<div class="clr"></div>
			</div>
			<?php } ?>
			
		</div>
		<div class="clr space20"></div>
		<!--<div>
			<a href="#"><img src="<?php echo JURI::base(); ?>templates/rhuk_milkyway/images/footer_banner.jpg" alt=""/></a>
		</div>-->
	</div>
	
	<div class="clr"></div>
</div>
<script type="text/javascript"> 
	$(document).ready(function(){
	$("#picture-slides-thumbnails ul li img").click(function() {
		var mainImage = $(this).attr("src"); //Find Image Name
		$("#picture-slides-image").attr({ src: mainImage });
		return false;		
	});
});
</script> 